Optimal. Leaf size=228 \[ -\frac{(a B+A b n) (a+b \tan (c+d x))^{n+1} \text{Hypergeometric2F1}\left (1,n+1,n+2,\frac{b \tan (c+d x)}{a}+1\right )}{a^2 d (n+1)}-\frac{(A-i B) (a+b \tan (c+d x))^{n+1} \text{Hypergeometric2F1}\left (1,n+1,n+2,\frac{a+b \tan (c+d x)}{a-i b}\right )}{2 d (n+1) (b+i a)}+\frac{(A+i B) (a+b \tan (c+d x))^{n+1} \text{Hypergeometric2F1}\left (1,n+1,n+2,\frac{a+b \tan (c+d x)}{a+i b}\right )}{2 d (n+1) (-b+i a)}-\frac{A \cot (c+d x) (a+b \tan (c+d x))^{n+1}}{a d} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.447354, antiderivative size = 228, normalized size of antiderivative = 1., number of steps used = 9, number of rules used = 7, integrand size = 31, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.226, Rules used = {3609, 3653, 3539, 3537, 68, 3634, 65} \[ -\frac{(a B+A b n) (a+b \tan (c+d x))^{n+1} \, _2F_1\left (1,n+1;n+2;\frac{b \tan (c+d x)}{a}+1\right )}{a^2 d (n+1)}-\frac{(A-i B) (a+b \tan (c+d x))^{n+1} \, _2F_1\left (1,n+1;n+2;\frac{a+b \tan (c+d x)}{a-i b}\right )}{2 d (n+1) (b+i a)}+\frac{(A+i B) (a+b \tan (c+d x))^{n+1} \, _2F_1\left (1,n+1;n+2;\frac{a+b \tan (c+d x)}{a+i b}\right )}{2 d (n+1) (-b+i a)}-\frac{A \cot (c+d x) (a+b \tan (c+d x))^{n+1}}{a d} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 3609
Rule 3653
Rule 3539
Rule 3537
Rule 68
Rule 3634
Rule 65
Rubi steps
\begin{align*} \int \cot ^2(c+d x) (a+b \tan (c+d x))^n (A+B \tan (c+d x)) \, dx &=-\frac{A \cot (c+d x) (a+b \tan (c+d x))^{1+n}}{a d}-\frac{\int \cot (c+d x) (a+b \tan (c+d x))^n \left (-a B-A b n+a A \tan (c+d x)-A b n \tan ^2(c+d x)\right ) \, dx}{a}\\ &=-\frac{A \cot (c+d x) (a+b \tan (c+d x))^{1+n}}{a d}-\frac{\int (a+b \tan (c+d x))^n (a A+a B \tan (c+d x)) \, dx}{a}+\frac{(a B+A b n) \int \cot (c+d x) (a+b \tan (c+d x))^n \left (1+\tan ^2(c+d x)\right ) \, dx}{a}\\ &=-\frac{A \cot (c+d x) (a+b \tan (c+d x))^{1+n}}{a d}-\frac{1}{2} (A-i B) \int (1+i \tan (c+d x)) (a+b \tan (c+d x))^n \, dx-\frac{1}{2} (A+i B) \int (1-i \tan (c+d x)) (a+b \tan (c+d x))^n \, dx+\frac{(a B+A b n) \operatorname{Subst}\left (\int \frac{(a+b x)^n}{x} \, dx,x,\tan (c+d x)\right )}{a d}\\ &=-\frac{A \cot (c+d x) (a+b \tan (c+d x))^{1+n}}{a d}-\frac{(a B+A b n) \, _2F_1\left (1,1+n;2+n;1+\frac{b \tan (c+d x)}{a}\right ) (a+b \tan (c+d x))^{1+n}}{a^2 d (1+n)}+\frac{(i A-B) \operatorname{Subst}\left (\int \frac{(a+i b x)^n}{-1+x} \, dx,x,-i \tan (c+d x)\right )}{2 d}-\frac{(i A+B) \operatorname{Subst}\left (\int \frac{(a-i b x)^n}{-1+x} \, dx,x,i \tan (c+d x)\right )}{2 d}\\ &=-\frac{A \cot (c+d x) (a+b \tan (c+d x))^{1+n}}{a d}+\frac{(i A+B) \, _2F_1\left (1,1+n;2+n;\frac{a+b \tan (c+d x)}{a-i b}\right ) (a+b \tan (c+d x))^{1+n}}{2 (a-i b) d (1+n)}+\frac{(A+i B) \, _2F_1\left (1,1+n;2+n;\frac{a+b \tan (c+d x)}{a+i b}\right ) (a+b \tan (c+d x))^{1+n}}{2 (i a-b) d (1+n)}-\frac{(a B+A b n) \, _2F_1\left (1,1+n;2+n;1+\frac{b \tan (c+d x)}{a}\right ) (a+b \tan (c+d x))^{1+n}}{a^2 d (1+n)}\\ \end{align*}
Mathematica [A] time = 0.369548, size = 202, normalized size = 0.89 \[ \frac{(a+b \tan (c+d x))^{n+1} \left (a^2 (a+i b) (A-i B) \text{Hypergeometric2F1}\left (1,n+1,n+2,\frac{a+b \tan (c+d x)}{a-i b}\right )-(a-i b) \left (a^2 (A+i B) \text{Hypergeometric2F1}\left (1,n+1,n+2,\frac{a+b \tan (c+d x)}{a+i b}\right )+2 (b-i a) \left (a B \text{Hypergeometric2F1}\left (1,n+1,n+2,\frac{b \tan (c+d x)}{a}+1\right )-A b \text{Hypergeometric2F1}\left (2,n+1,n+2,\frac{b \tan (c+d x)}{a}+1\right )\right )\right )\right )}{2 a^2 d (n+1) (a-i b) (b-i a)} \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [F] time = 0.343, size = 0, normalized size = 0. \begin{align*} \int \left ( \cot \left ( dx+c \right ) \right ) ^{2} \left ( a+b\tan \left ( dx+c \right ) \right ) ^{n} \left ( A+B\tan \left ( dx+c \right ) \right ) \, dx \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [F] time = 0., size = 0, normalized size = 0. \begin{align*} \int{\left (B \tan \left (d x + c\right ) + A\right )}{\left (b \tan \left (d x + c\right ) + a\right )}^{n} \cot \left (d x + c\right )^{2}\,{d x} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [F] time = 0., size = 0, normalized size = 0. \begin{align*}{\rm integral}\left ({\left (B \cot \left (d x + c\right )^{2} \tan \left (d x + c\right ) + A \cot \left (d x + c\right )^{2}\right )}{\left (b \tan \left (d x + c\right ) + a\right )}^{n}, x\right ) \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F(-1)] time = 0., size = 0, normalized size = 0. \begin{align*} \text{Timed out} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [F] time = 0., size = 0, normalized size = 0. \begin{align*} \int{\left (B \tan \left (d x + c\right ) + A\right )}{\left (b \tan \left (d x + c\right ) + a\right )}^{n} \cot \left (d x + c\right )^{2}\,{d x} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]